<div class="bg-white h-[90vh] lg:h-[70vh] w-full lg:w-1/3 flex flex-col overflow-hidden">
  <%= form_for @address, method: :put, html: { class: "flex flex-col h-full", data: { turbo_frame: "_top" } } do |f| %>
    <div class="px-8 py-6 border-b shrink-0">
      <div class="flex justify-between items-center">
        <h3 class="text-xl lg:text-2xl font-medium lg:font-semibold capitalize">
          <%= Spree.t(:edit_address) %>
        </h3>
        <button data-action="click->modal#close" class="ml-4">
          <%= render 'spree/shared/icons/close' %>
          <span class="sr-only"><%= Spree.t(:close) %></span>
        </button>
      </div>
      <%= render 'spree/shared/error_messages', target: @address, class: 'alert-error text-center mt-4 p-2' %>
    </div>
    <div class="overflow-y-auto px-8 py-2 grow">
      <div class="py-4 text-left">
        <%= render 'spree/addresses/form',
          address_name: 'address',
          address_form: f,
          address_type: 'shipping',
          address: @address %>
      </div>
      <%= label_tag "default_shipping", class: "flex items-center gap-2 text-sm mb-4" do %>
        <%= check_box_tag "default_shipping", "true", @address.user_default_shipping?, class: 'input-checkbox input-address-default', disabled: @address.user_default_shipping? %>
        <%= Spree.t('address_book.set_as_default_delivery_address') %>
      <% end %>
      <%= label_tag "default_billing", class: "flex items-center gap-2 text-sm mb-4" do %>
        <%= check_box_tag "default_billing", "true", @address.user_default_billing?, class: 'input-checkbox input-address-default', disabled: @address.user_default_billing? %>
        <%= Spree.t('address_book.set_as_default_billing_address') %>
      <% end %>
    </div>
    <div class="border-t border-default px-8 py-4 flex justify-end gap-8 shrink-0">
      <%= button_tag Spree.t(:cancel), class: 'uppercase text-sm font-semibold', data: { action: 'click->modal#close' } %>
      <%= hidden_field_tag :from_modal, "true" %>
      <%= f.submit Spree.t(:update), class: 'btn-primary w-48' %>
    </div>
  <% end %>
</div>
